package StudyCode.summary.mydatetime;

import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class StringConvertToSQLDate {
	public static void main(String args[]) throws ParseException {
		String strDate = "2018-11-11 11:11:11";
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
		java.util.Date date = sdf.parse(strDate);
		java.sql.Date sqlDate = new Date(date.getTime());
		System.out.println("String 转为 java.sql.Date :" + sqlDate);
	}
}
